#ifndef IMAGEMODEL_H
#define IMAGEMODEL_H
#include <QString>
#include <QAbstractListModel>
#include <qqmlengine.h>
#include "ImageLabelModel.h"
#include "BaseResult.h"
#include <QDir>


#include <QDir>
#include <QAbstractListModel>
#include "ImageLabelModel.h"
#include "BaseResult.h"

class ImageModel : public QAbstractListModel {
Q_OBJECT

public:
     static ImageModel* getInstance() {
         if(instance == nullptr) {
            instance = new ImageModel();
         }
        return instance;
    }
    explicit ImageModel(QObject *parent = nullptr);
    ~ImageModel();

    int rowCount(const QModelIndex &parent = QModelIndex()) const override;
    QVariant data(const QModelIndex &index, int role = 1) const override;


    Q_INVOKABLE BaseResult::JsonResult openDir(QString dir);
    QString get(const int &index);
    Q_INVOKABLE int count() const;

    Q_INVOKABLE void setSavePath(QString savePath);
   // Q_INVOKABLE void setDir(QString savePath);
    Q_INVOKABLE QString getImageName(int index);
    QString getImageLabelSaveFilePath(int index);

protected:
    virtual QHash<int, QByteArray> roleNames() const;

private:
    static ImageModel* instance;
    QList<QString> _dataList_;
    QString dir;
    QString savePath;

};

#endif // IMAGEMODEL_H
